"""Test case for django_ldap.managers"""


manager_test = """
# django_ldap should not change the behavior of database models
>>> from django_ldap.tests.fixtures import db_model, ldap_model
>>> db_model.objects.__class__
<class 'django.db.models.manager.Manager'>

# django_ldap models should have their own customized manager
>>> from django_ldap.managers import Manager
>>> isinstance(ldap_model.objects, Manager)
True

# test django_ldap manager apis
>>> ldap_model.objects.all().count()
2
>>> ldap_model.objects.filter(cn='testuser1')[0]
<ldap_model: ldap_model object>
>>> ldap_model.objects.filter(cn='invaliduser').count()
0
>>> ldap_model.objects.filter(cn='testuser1', sn='test1')[0].cn
u'testuser1'
>>> ldap_model.objects.exclude(sn='test1')[0].cn
u'testuser2'
>>> ldap_model.objects.all().values('cn')[0]
{'cn': u'testuser1'}
>>> obj = ldap_model.objects.create(cn='testuser4',sn='test4')
>>> ldap_model.objects.filter(sn='test4').filter(pk=obj.pk, cn='testuser4')[0].sn
u'test4'
>>> ldap_model.objects.filter(cn='testuser4').delete()
"""

__test__ = {
    'manager_test': manager_test,
}